package com.epalmpay.controller.channel.datareport;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.epalmpay.commom.BaseController;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.status.Rescode;
import com.epalmpay.dto.datareport.AccountDataReportInDTO;
import com.epalmpay.dto.datareport.AccountDataReportListOutDTO;
import com.epalmpay.entity.GroupAccount;
import com.epalmpay.service.datareport.IAccountDataReportService;

/** 
 * 说明：数据报表 :账户余额数据报表
 * 创建人：gwn
 * 创建时间：2017-06-23
 */

@Controller
@RequestMapping(value="/merchant/accountDataReport")
public class AccountDataReportController extends BaseController {
	
	@Resource
	private IAccountDataReportService accountDataReportService;
	
	
	@RequestMapping(value="/list")
	@ResponseBody
	public AccountDataReportListOutDTO List(AccountDataReportInDTO accountDataReportInDTO){
		
		AccountDataReportListOutDTO accountDataReportListOutDTO= new AccountDataReportListOutDTO();
		try {
			//会员钱包数据余额
			//商户钱包账户余额
			//代理商账户余额
			//营销账户余额
			GroupAccount groupAccount = accountDataReportService.queryGroupAccountBalance(accountDataReportInDTO);
			accountDataReportListOutDTO.setGroupAccount(groupAccount);
			//渠道账户余额
			
			accountDataReportListOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return accountDataReportListOutDTO;
		} catch (ApplicationException ae) { 
			accountDataReportListOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
		}catch (Exception e) {
			accountDataReportListOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
				e.printStackTrace();
		}
		return accountDataReportListOutDTO;
		
	}

}
